#include <iostream>
using namespace std;

const int NMAX=10;

int a[NMAX];
int n;

void clear()
{ n=0; }

void push(int x)
{ if(n<NMAX)
  { a[n]=x; n++; }
}

int top()
{ return a[n-1]; }

void pop()
{ n--; }

int size()
{ return n; }

bool empty()
{ return n==0; }

int main()
{ clear();
  push(10); push(15); push(12);
  cout << top() << endl;
  cout << size() << endl;
  pop();
  cout << top() << endl;
  cout << size() << endl;
  push(30);
  
  while(!empty())
  { cout << top() << " ";
    pop();
  }  
  cout << endl;
 
  return 0;
}    
    
  
